package com.frejoys.dao.mapper.huajuan;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.frejoys.dao.entity.huajuan.HuajuanUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface HuajuanUserMapper extends BaseMapper<HuajuanUser> {

    @Select("select id from j_huajuan_user where phone = #{phone}")
    HuajuanUser getInfo(@Param("phone") String phone);

    @Insert("insert into j_huajuan_user (phone, huajuan_user_id, user_id) values (#{phone}, #{huajuanUserId}, #{userId})")
    boolean saveInfo(@Param("phone") String phone, @Param("huajuanUserId") Integer huajuanUserId, @Param("userId") Long userId);

    @Select("select huajuan_user_id from j_huajuan_user where user_id = #{userId}")
    Integer getHuajuanUserIdInteger(@Param("userId") Long userId);

}
